#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
class Solution {
public:
  string convertToBase7(int num) {
    if (num == 0)
      return "0";
    char res[12] = {0};
    string ress;
    bool nag = false;
    int count = 10;
    if (num < 0) {
      nag = true;
      num = -num;
    }
    while (num != 0) {
      res[count] = '0' + (num % 7);
      num = num / 7;
      --count;
    }
    if (nag) {
      res[count] = '-';
      --count;
    }
    ress = &(res[++count]);
    return ress;
  }
};
int main(int argc, char *argv[]) {
  Solution s;
  cout << s.convertToBase7(-7).data() << endl;
  return 0;
}
